package com.example.shiro.common.exception;


import com.example.shiro.common.response.CommonCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @auther 严旭平
 * @date 2020/4/818:36
 * @Description 自定义异常类
 */
@Data
@ApiModel(value = "自定义异常")
public class MyException extends RuntimeException {

    @ApiModelProperty(value = "状态码")
    private Integer code;

    /**
     * 只接受信息的自定义异常
     *
     * @param message
     */
    public MyException(String message) {
        super(message);
        this.code = CommonCode.CUSTOMIZE_ERROR.getCode();
    }

    /**
     * 接受状态码和响应信息的自定义异常
     *
     * @param code
     * @param message
     */
    public MyException(Integer code, String message) {
        super(message);
        this.code = code;
    }


}
